package com.prb.config;

import com.alibaba.druid.pool.DruidDataSource;
import com.prb.annotation.Bean;
import com.prb.annotation.Configuration;
import com.prb.factory.ConnectionFactory;

import javax.sql.DataSource;

@Configuration
public class BeanConfig {

    @Bean
    public DataSource dataSource(){

        DruidDataSource dataSource  = new DruidDataSource();
        dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
        dataSource.setUrl("jdbc:mysql://139.9.2.241:3306/test");
        dataSource.setUsername("root");
        dataSource.setPassword("123456");

        return dataSource;
    }


    @Bean
    public ConnectionFactory connectionFactory(){

        return new ConnectionFactory();
    }

}
